<?php

/*
 * HELPER CLASS
 */
class ROI_type {
  // default vals
  public $roi_0 =  1;
  public $roi_1 = -1;
}

/*
 * HELPER CLASS
 */
class IMG_INDIR {
  public $indir = "_default_";
}
class IMG_OUTDIR {
  public $outdir = "_default_";
}

/*
 * HELPER CLASS - for <IMAGE> which is the child of <image>
 */
class IMAGE {
  // default vals
  public $Nx = 0;
  public $Ny = 0;
  public $Nz = 0;
}

/*
 * HELPER CLASS
 */
class COMPROI {
  // default vals
  public $comproi = 0;  // int [0,5]
  public $foa_threshold = 0.0; // float 
  public $foa_outsidemax = 0.0; // float
}

/*
 * HELPER CLASS - simulates an Enumeration type
 */
abstract class ImageType {
  
  const U16  = "U16";
  const F32  = "F32";
  const FITS = "FITS";
  const PGM  = "PGM";
}

/*
 * HELPER CLASS
 */
class CLIP {
  // default vals
  public $clipmin = 0.0; // float
  public $clipmax = 0.0; // float
}

/*
 *  HELPER CLASS
 */
class VOXEL {
  // default vals
  public $dxy = 0.0;  // float
  public $dz  = 0.0;  // float
}


/**
 * Class for passing around values associated with a job's <image> params. 
 *
 * @author Jason
 */
class Params_Image {
  
  /* @var ROI_type */
  public $ROI_X;
  /* @var ROI_type */
  public $ROI_Y;
  /* @var ROI_type */
  public $ROI_Z;
  
  /* @var IMG_INDIR */
  public $IMG_INDIR;
  /* @var IMG_OUTDIR */
  public $IMG_OUTDIR;
  
  /* @var IMAGE */
  public $IMAGE;
  /*@var COMPROI */
  public $COMPROI;
  /* @var $imageType ImageType */
  public $imageType;  // uses enumberated type defined above
  /* @var $CLIP CLIP */
  public $CLIP;
  /* @var $VOXEL VOXEL */
  public $VOXEL;
  
  /*
   * Constructor. The arguments are the required direct children of <image>.
   * 
   * @imageType: One of the enumerated types in abstract class ImageType: U16, F32, FITS, PGM
   */
  public function __construct($imageType, IMAGE $IMAGE, COMPROI $COMPROI, VOXEL $VOXEL) {
  
    $this->imageType = $imageType;
    // Make sure valid imageType was passed in. Switch also provides structure for future enhancements.
    switch($this->imageType) {
      case ImageType::U16:   break;
      case ImageType::F32:   break;
      case ImageType::FITS:  break;
      case ImageType::PGM:   break;
      default: 
        die("\nError in class Params_Image constructor: Invalid imageType provided."
            ."\n  You provided: $imageType."
            ."\n  Should be one of {ImageType::U16}, {ImageType::F32},{ImageType::FITS},{ImageType::PGM}.\n");
    } //// end switch(imageType) /////
    
    $this->IMAGE   = $IMAGE;
    $this->COMPROI = $COMPROI;
    $this->VOXEL   = $VOXEL;
    
    if(FALSE) {
      $this->IMAGE = new IMAGE();
    }
  } ///// end constructor //////////////

} //////// end class /////////////////////////////////

?>
